00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _dae_solver_interface_hpp_
00022 #define _dae_solver_interface_hpp_
00023
00024 #include <gridpack/math/vector.hpp>
00025 #include <gridpack/math/matrix.hpp>
00026
00027 #include <gridpack/math/dae_solver_functions.hpp>
00028
00029 namespace gridpack {
00030 namespace math {
00031
00032
00033
00034
00035 template <typename T, typename I = int>
00036 class DAESolverInterface
00037 {
00038 public:
00039
00040 typedef typename DAEBuilder<T, I>::VectorType VectorType;
00041 typedef typename DAEBuilder<T, I>::MatrixType MatrixType;
00042 typedef typename DAEBuilder<T, I>::Jacobian JacobianBuilder;
00043 typedef typename DAEBuilder<T, I>::Function FunctionBuilder;
00044 typedef typename DAEBuilder<T, I>::StepFunction StepFunction;
00045
00046
00047 DAESolverInterface(void)
00048 {
00049 }
00050
00051
00052 virtual ~DAESolverInterface(void)
00053 {
00054 }
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064 void initialize(const double& t0,
00065 const double& deltat0,
00066 VectorType& x0)
00067 {
00068 this->p_initialize(t0, deltat0, x0);
00069 }
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 void solve(double& maxtime, int& maxsteps)
00087 {
00088 this->p_solve(maxtime, maxsteps);
00089 }
00090
00091
00092 void preStep(StepFunction& f)
00093 {
00094 this->p_preStep(f);
00095 }
00096
00097
00098 void postStep(StepFunction& f)
00099 {
00100 this->p_postStep(f);
00101 }
00102
00103 protected:
00104
00105
00106 virtual void p_initialize(const double& t0,
00107 const double& deltat0,
00108 VectorType& x0) = 0;
00109
00110
00111
00112 virtual void p_solve(double& maxtime, int& maxsteps) = 0;
00113
00114
00115 virtual void p_preStep(StepFunction& f) = 0;
00116
00117
00118 virtual void p_postStep(StepFunction& f) = 0;
00119
00120 };
00121
00122
00123
00124 }
00125 }
00126
00127 #endif